package com.newegg.nlp.arangodb.dao;

import com.newegg.nlp.arangodb.BasicDao;
import com.newegg.nlp.arangodb.model.Keyword;

public interface KeywordDao extends BasicDao<Keyword>{
	
	default Keyword getOrCreate(String keyword) {
		Keyword kw = get(keyword.replace(" ", "_"));
		if(kw == null) {
			kw = new Keyword();
			kw.setId(keyword.replace(" ", "_"));
			kw.setName(keyword);
			saveNotExist(kw);
		}
		return kw;
	};
	
}